<?php
/**
 * xysc users Version1.0
 * ==================================
 * Copy 2016-2017
 * Web:www.xjh7.com
 * ==================================
 * Author:xjh
 * Date:2016-2-25
*/
class IndexController extends Controller{
	//访问控制
	function filters(){
		return array(
			'accessControl'
		);
	}
	function accessRules(){
		return array(
			array(
				'allow',
				'actions'=>array('Top','Left','Right','Index'),
				'users'=>array('@')
			),
			array(
				'deny',
				'users'=>array('*'),
			),
		);
	}
	//头部
	function actionTop(){
		if(Yii::app()->user->name != ''){
			$lg_model = new LoginForm();
			$result = $lg_model->getRoleName();
		}
		$this->renderPartial('top',array('role_name'=>$result[0]['role_name']));
	}
	//左部菜单
	function actionLeft(){
		if(Yii::app()->user->name != ''){
			$lg_model = new LoginForm();
			$info = $lg_model->getMenu();
		}		
	
		$this->renderPartial('left',array('info'=>$info));
	}
	//右侧主体内容
	function actionRight(){
		$user_model = Manager::model();
		$info = $user_model->findBySql("SELECT * FROM xy_user WHERE user_name='".Yii::app()->user->name."'");
		$_gd = in_array("gd",get_loaded_extensions());
		$_gd = ($_gd)? "是":"否";
		$this->renderPartial('right',array('user_register'=>$info->user_register,'user_last_time'=>$info->user_last_time,'user_last_ip'=>$info->user_last_ip,'_gd'=>$_gd));
	}
	//三部分集合
	function actionIndex(){
		if(Yii::app()->user->name != ''){
			$lg_model = new LoginForm();
			$info = $lg_model->getMenu();
			$result = $lg_model->getRoleName();
		}	
		$this->renderPartial('index',array('info'=>$info,'role_name'=>$result[0]['role_name']));
	}
}
?>